package  
{
	import components.skins.DefaultButtonSkin;
	import components.skins.DefaultIconButtonSkin;
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import soundManager.SoundManager;
	import ui.controls.SButton;
	import ui.controls.SIcon;
	import ui.controls.SLabelButton;
	import ui.events.SEvent;
	import ui.skins.BaseButtonSkin;
	import ui.skins.Skin;


	
	/**
	 * ...
	 * @author SChabanov
	 */
	public class ControlsTest extends Sprite 
	{
		
		private var provider:Array;
		
		public function ControlsTest() 
		{
			super();
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align     = StageAlign.TOP_LEFT;
			
			stage.addEventListener(Event.RESIZE, onResize);
		
			//addChild(skin.skinUp);
			
			var sbutton:SButton = new SButton();
			sbutton.useHandCursor = true;
			sbutton.onClickCallBack = onClickHandler;
			sbutton.addListener(SEvent.S_CREATED, onCreatedHandler);
			sbutton.addListener(SEvent.S_DESTROYED, onDestroyedHandler);
			sbutton.create(this, 1000);
			sbutton.icon = DefaultIconButtonSkin;
			//sbutton.changeLabelStyle({bold:true,size:20,align:"center"});
			//sbutton.changeSkin(DefaultButtonSkin);
			sbutton.addListener(SEvent.S_CLICK, onClickHandler);
			sbutton.move(100, 100);
			//sbutton.changeSkin(DefaultIconButtonSkin);
			sbutton.setSize(100, 100);
			sbutton.invalidate();
			//box.update();
			
			
			var slabelbutton:SLabelButton = new SLabelButton();
			slabelbutton.move(300, 100);
			slabelbutton.create(this);
			slabelbutton.changeSkin(DefaultButtonSkin);
			slabelbutton.setSize(200, 100);
			slabelbutton.changeLabelStyle( { align:"left", color:0 } );

			var sicon:SIcon = new SIcon();
			sicon.move(400, 600);
			sicon.changeSkin(DefaultIconButtonSkin);
			sicon.create(this);
			
			//box.setSize(400, 300);
			//btn.setSize(200, 100);
			//btn.label = "button"
			/*btn.x = 100;
			btn.y = 100;*/
			SoundManager.addSoundItem("Dr.Dre", "Dr. Dre - Bang Bang.mp3", 0, 1,1,1);
			SoundManager.addSoundItem("Dr.Dre", "Dr. Dre - Bang Bang.mp3", 0, 1,1,1);
			SoundManager.addSoundItem("clack", "cell-phone-flip-1.mp3",0, 1,1);

		
			
		}
		
		private function onDestroyedHandler(e:SEvent):void 
		{
			trace("destroyed")
		}
		
		private function onCreatedHandler(e:SEvent):void 
		{
			trace("created");
		}
		
		private function onClickHandler(e:SEvent):void 
		{
			if(e)trace("clicked" + e.component.name);
			
		}
		
		
		
		
		private function fillHorizontalProvider():void 
		{
			provider = [];
			var urls:Array = ["http://www.citygame.ru/Content/img/flashplayer_100x100.jpg",
							  "http://upload.wikimedia.org/wikipedia/commons/thumb/9/9f/Adobe_Flash_Pro_CS5_icon.png/100px-Adobe_Flash_Pro_CS5_icon.png",
							  'http://www.htc-ukraine.com/upload/iblock/67d/abobe-flash.jpg',
							  'http://upload.wikimedia.org/wikipedia/uk/thumb/3/3a/Adobe_Flash_cs3.png/100px-Adobe_Flash_cs3.png',
							  'http://images.apple.com/safari/images/download-plugins-flash-20090224.png',
							  "http://softline.ua/upload/iblock/608/adobe-flash-player.jpeg", 
							  "http://softline.ua/upload/iblock/608/adobe-flash-player.jpeg", 
							  "http://softline.ua/upload/iblock/608/adobe-flash-player.jpeg"];
							  
			for (var i:int = 0; i < urls.length; i++) 
			{
				provider.push({path:urls[i],text:"Label_"+i.toString()});
			}
			
		}
		private function fillProvider():void
		{
			provider = [];
			for (var i:int = 0; i < 20; i++) 
			{
				provider.push({text:"Item_" + (i + 1)});
			}
		}
		
			
		
		
		private function onSoundRepeat(e:Event):void 
		{
			SoundManager.playSound("track", onSoundRepeat);
		}
	
				
		private function onResize(e:Event):void 
		{
			
		}
		
	}

}